package com.klst.opennlp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PipedInputStream;
import java.util.logging.Logger;

public class TigerInputConsumer extends PipedInputStream implements Runnable {

  private final static Logger LOG = Logger.getLogger(TigerInputConsumer.class.getName());
  
//  public TigerInputStream() {
//    super();
//  }
//  
//  public TigerInputStream(int pipeSize) {
//    super(pipeSize);
//    LOG.info("ctor pipeSize="+pipeSize);
//  }
//
//  public synchronized int read() throws IOException {
//    int ret = super.read();
//    LOG.info("ret="+ret);
//    return ret;
//  }
//
//  public synchronized int read(byte b[], int off, int len)  throws IOException {
////    LOG.info("read(b off len) len="+len);
//    int ret = super.read(b, off, len);
//    if(ret<0)
//      return ret;
//    String s = new String(b);
//    LOG.info("ret="+ret 
//        +":"+s.substring(0, ret)
//        );
//    return ret;
//  }

  @Override
  public void run() {
    LOG.info("run()");
    try {
      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this));
      String temp = null;
      while ((temp = bufferedReader.readLine()) != null) {
//        LOG.info(temp + "// len="+temp.length());
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

}
